#返回唯一的xpath结果

def xpath_one(contentx,path,default = None):
    rets = contentx.xpath(path)
    return rets[0] if rets else  default


#返回多个xpath结果
def xpath_all(contents,path):
    rets = contents.xpath(path)
    return rets

def xpath_union(contents,path,split = "",default=None):
    ret = split.join(
        [ret.strip() for ret in contents.xpath(path)]
    )
    return ret if ret else default

# d = dict((['name', "nico"], ['age', 23]))
# print(d)

